package great.easychat.help.http;

import com.pince.renovace2.thread.RenovaceThread;
import com.pince.renovace2.thread.ThreadStrategy;
import com.qizhou.annotation.AutoApi;

import io.reactivex.Observable;
import retrofit2.http.GET;
import retrofit2.http.Query;

/**
 * @author SuperMan
 * @date 2021/02/18 0018
 */
public interface HttpService {
//
//    @AutoApi(keys = {"app_key", "model_name", "logic", "where"}, defaultValues = {Constant.XIAOBAI_APP_KSY, "app_config", "and", "[[\"config_type\", \"=\", \"" + Constant.CONFIG_NAME + "\"]]"})
//    @RenovaceThread(observeThread = ThreadStrategy.MAIN)
//    @GET("http://hd215.api.yesapi.cn/?s=App.Table.FreeFindOne")
//    Observable<Object> getConfig();


    @AutoApi()
    @RenovaceThread(observeThread = ThreadStrategy.MAIN)
    @GET("http://hd215.api.yesapi.cn/?s=App.Table.FreeFindOne")
    Observable<String> getConfig(@Query("app_key") String app_key,
                                 @Query("model_name") String model_name,
                                 @Query("logic") String logic,
                                 @Query("where") String where);

    @AutoApi()
    @RenovaceThread(observeThread = ThreadStrategy.MAIN)
    @GET("http://hd215.api.yesapi.cn/?s=App.Table.FreeFindOne")
    Observable<String> getUserInfo(@Query("app_key") String app_key,
                                   @Query("model_name") String model_name,
                                   @Query("logic") String logic,
                                   @Query("where") String where);

    /**
     * 在数据库插入一条非重复新数据
     * @param app_key
     * @param model_name
     * @param check_field
     * @param data
     * @return
     */
    @AutoApi()
    @RenovaceThread(observeThread = ThreadStrategy.MAIN)
    @GET("http://hd215.api.yesapi.cn/?s=App.Table.CheckCreate")
    Observable<String> addDataItemCheck(@Query("app_key") String app_key,
                                   @Query("model_name") String model_name,
                                   @Query("check_field") String check_field,
                                   @Query("data") String data);

    @AutoApi()
    @RenovaceThread(observeThread = ThreadStrategy.MAIN)
    @GET("http://hd215.api.yesapi.cn/?s=App.Table.Create")
    Observable<String> addDataItem(@Query("app_key") String app_key,
                                   @Query("model_name") String model_name,
                                   @Query("data") String data);

}
